<template>
  <div class="block-box">
    <div class="block-box_item">
      <div class="block-box_title">记录详情</div>
      <van-cell-group>
        <van-field
          label="检查人"
          class="input_text"
          :value="form.CreateChnName"
          readonly
        />
        <van-field
          label="检查日期"
          class="input_text"
          :value="getDateTime(form.CreateDate)"
          readonly
        />
        <van-field
          label="最新状态"
          class="input_text"
          :value="form.StatusName"
          readonly
        />
        <van-field
          label="来源"
          class="input_text"
          :value="
            form.OriginType == 1
              ? '检查表检查'
              : form.StatusName == 2
              ? '依据检查'
              : '随手拍'
          "
          readonly
        />
        <van-field
          v-if="form.OriginType == 1"
          label="检查内容"
          class="input_text"
          rows="1"
          autosize
          type="textarea"
          :value="form.DetailItemName"
          readonly
        />
        <van-field
          label="检查结果"
          class="input_text"
          :value="
            form.CheckResult == 'N'
              ? '不符合'
              : form.CheckResult == 'NA'
              ? '不适用'
              : '符合'
          "
          readonly
        />

        <template v-if="form.Type != '2'">
          <van-field
            v-model="form.OrderNo"
            label="物料批次信息1"
            class="input_text"
            readonly
          >
          </van-field>
          <van-field
            v-if="form.Spec"
            v-model="form.Spec"
            label="物料批次信息2"
            class="input_text"
            readonly
          >
          </van-field>
          <van-field
            v-model="form.Model"
            v-if="form.Model"
            label="物料批次信息3"
            class="input_text"
            readonly
          >
          </van-field>
          <van-field
            v-if="form.Model2"
            v-model="form.Model2"
            label="物料批次信息4"
            class="input_text"
            readonly
          >
          </van-field>
          <van-field
            v-if="form.Model3"
            v-model="form.Model3"
            label="物料批次信息5"
            class="input_text"
            readonly
          >
          </van-field>
        </template>
        <template v-if="form.Type == '2'">
          <van-field
            v-model="form.VideoRange"
            class="input_text"
            label="视频查询时间段"
            placeholder="请输入"
            readonly
          >
          </van-field>
          <van-field
            v-model="form.SearchResult"
            label="搜索结果"
            class="input_text"
            placeholder="请输入"
            readonly
          >
          </van-field>
          <van-field
            v-model="form.BreakDesc"
            label="违规详情"
            class="input_text"
            placeholder="请输入"
            rows="3"
            autosize
            type="textarea"
            readonly
          >
          </van-field>
        </template>

        <div v-if="form.CheckResult == 'N'">
          <van-field
            class="input_text"
            name="Attachs"
            label="隐患图片"
          >
            <template #input>
              <eagle-image-preview :images="form.Attachs"></eagle-image-preview>
            </template>
          </van-field>
          <van-field
            label="隐患区域"
            class="input_text"
            type="textarea"
            rows="1"
            autosize
            v-model="form.HiddenDangerArea"
            readonly
          />
          <van-field
            label="隐患详细地点"
            class="input_text"
            type="textarea"
            rows="1"
            autosize
            v-model="form.HiddenDangerAddress"
            readonly
          />
          <van-field
            label="隐患描述"
            class="input_text"
            v-model="form.HiddenDangerDesc"
            rows="1"
            autosize
            type="textarea"
            readonly
          />
          <van-field
            label="隐患分类"
            class="input_text"
            :value="form.LGDFullName"
            readonly
          />
          <van-field
            label="直接责任人"
            class="input_text"
            :value="form.PersonInChargeChnName"
            readonly
          />
          <van-field
            label="整改建议"
            class="input_text"
            rows="1"
            autosize
            type="textarea"
            :value="form.CorrectiveAdvise || '无'"
            readonly
          />
          <van-field
            v-if="form.Status >= 30"
            label="整改部门"
            class="input_text"
            :value="form.CorrectiveDeptName"
            readonly
          />
          <van-field
            v-if="form.Status >= 40"
            label="整改人"
            class="input_text"
            :value="form.CorrectiveChnName"
            readonly
          />
          <van-field
            v-if="form.PlanCorrectiveDate"
            label="计划整改期限"
            class="input_text"
            :value="getDate(form.PlanCorrectiveDate)"
            readonly
          />

          <van-field
            v-if="form.Status >= 45 && form.Analysis"
            label="原因分析"
            type="textarea"
            autosize
            class="input_text"
            :value="form.Analysis"
            readonly
          />
          <van-field
            v-if="form.Status >= 45"
            label="整改方式"
            class="input_text"
            :value="form.CorrectiveMethod == 1 ? '立即整改' : '限期整改'"
            readonly
          />
          <van-field
            v-if="form.Status >= 45 && form.CorrectiveMethod == 2"
            label="整改期限"
            class="input_text"
            :value="getDate(form.CorrectiveDate)"
            readonly
          />
          <van-field
            v-if="form.Status >= 45 && form.CorrectiveMethod == 2"
            label="整改措施"
            type="textarea"
            autosize
            class="input_text"
            :value="form.CorrectiveMeasure"
            readonly
          />
          <van-field
            v-if="form.Status >= 45 && form.Expenses"
            label="经费"
            class="input_text"
            :value="form.Expenses"
            readonly
          />

          <van-field
            v-if="form.Status >= 60"
            label="整改图片"
            class="input_text"
            :value="form.StatusName"
            readonly
          >
            <template #input>
              <eagle-image-preview :images="form.CorrectiveAttachs">
              </eagle-image-preview>
            </template>
          </van-field>
          <van-field
            v-if="form.Status >= 60"
            label="整改说明"
            type="textarea"
            autosize
            class="input_text"
            :value="form.CorrectiveDesc"
            readonly
          />
        </div>
        <div v-else>
          <van-field
            class="input_text"
            label="备注"
            type="textarea"
            autosize
            :value="form.Remarks"
            readonly
          />
        </div>
      </van-cell-group>
    </div>
    <div
      class="block-box_item mt-10"
      v-if="form.Status > 10"
    >
      <div class="block-box_title">操作历史记录</div>
      <div class="operate_list">
        <van-row class="operate_row_first">
          <van-col span="4">序号</van-col>
          <van-col
            offset="1"
            span="10"
          >操作</van-col>
        </van-row>
        <van-row
          v-for="(item, index) in form.LogList"
          :key="index"
          class="operate_row"
        >
          <van-col span="4">{{ index + 1 }}</van-col>
          <van-col
            offset="1"
            span="18"
          >{{ item.OperateLog }}

            <div v-if="item.Attachs">
              <eagle-image-preview :images="item.Attachs">
              </eagle-image-preview>
            </div>
          </van-col>
        </van-row>
      </div>
    </div>
  </div>
</template>

<script>
import { getDate, getDateTime } from "@/utils/getDate";
export default {
  props: {
    form: {},
  },
  data() {
    return {};
  },
  methods: {
    getDate(value) {
      return getDate(value);
    },
    getDateTime(value) {
      return getDateTime(value);
    },
  },
};
</script>

<style lang="less" scoped>
.operate_list {
  font-size: 12px;
  line-height: 16px;
  border: 1px solid #e8f1f8;
  .operate_row_first {
    padding: 10px;
    background-color: #e8f1f8;
    border-bottom: 1px solid #e8f1f8;
    margin-bottom: 10px;
  }
  .operate_row {
    padding: 10px;
    border-bottom: 1px solid #e8f1f8;
    line-height: 16px;
  }
}
</style>
